<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<th:block th:fragment="pagination(baseUrl, currentPage, totalPages, pageSize)">
    <nav class="mt-2" th:if="${totalPages > 1}">
        <ul class="pagination justify-content-center">
            <li class="page-item">
                <a class="page-link" th:href="@{${baseUrl}(page = 0,size = ${pageSize})}">首页</a>
            </li>
            <li th:class="|page-item ${currentPage == 0 ? 'disabled' : ''}|">
                <a class="page-link" th:href="@{${baseUrl}(page = ${currentPage - 1},size = ${pageSize})}">上一页</a></li>
            <li th:class="|page-item ${i == currentPage ? 'active' : ''}|"
                th:each="i:${#numbers.sequence(0, totalPages - 1)}">
                <a class="page-link" th:href="@{${baseUrl}(page = ${i}, size = ${pageSize})}" th:text="${i + 1}">1</a>
            </li>
            <li th:class="|page-item ${currentPage == totalPages - 1 ? 'disabled' : ''}|">
                <a class="page-link" th:href="@{${baseUrl}(page = ${currentPage + 1},size = ${pageSize})}">下一页</a>
            </li>
            <li class="page-item">
                <a class="page-link" th:href="@{${baseUrl}(page = ${totalPages - 1}, size = ${pageSize})}">末页</a>
            </li>
        </ul>
    </nav>
</th:block>
</html>